<template>
  <view class="container">
    <view class="box">
      <view class="info">
        <view>
          姓名
        </view>
        <view v-if="userInfo">{{ userInfo.name || ''}}
        </view>
      </view>

      <view class="info">
        <view>
          学/工号
        </view>
        <view v-if="userInfo">{{ userInfo.account || ''}}
        </view>
      </view>

      <view class="info ">

        <view>
          电话
        </view>
 
        <view v-if="userInfo && userInfo.phone !='未提供'">
          {{ userInfo.phone || ''}}

        </view>

      </view>

      <view class="info">
        <view>
          专业
        </view>
        <view v-if="userInfo">{{ userInfo.major || ''}}
        </view>
      </view>
      <view class="info">
        <view>
          班级
        </view>
        <view v-if="userInfo">{{ userInfo.className || ''}}
        </view>
      </view>
      <view class="info">
        <view>
          门牌
        </view>
        <view v-if="userInfo">{{ userInfo.ss_mc || ''}}
        </view>
      </view>
    </view>

  </view>
</template>

<script>
  export default {
    data() {
      return {
        userInfo: [],
        showModal: true,
      }
    },
    onShow() {
      this.getUserInfo();
    },
    methods: {

      getUserInfo() {
        if (!uni.getStorageSync('islogin') || uni.getStorageSync('islogin') == false) {
          uni.showToast({
            title: '请先登录',
            icon: 'none'
          });
          uni.navigateTo({
            url: '/pages/login/login'
          })
          return;
        }
        this.userInfo = uni.getStorageSync('userInfo');
      }
    }
  }
</script>

<style>
  .container {
    background-color: #e4e4e4;
    display: flex;
    align-items: center;
    flex-direction: column;
    height: 100vh;
  }

  .box {
    width: 90%;
    height: 60vh;
    background-color: #ffffff;
    margin: 5% 0 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;

  }

  .info {
    width: 80%;
    border-bottom: 0.1px solid #e4e4e4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 10px;
  }
</style>